package cn.zjutleo.village_server.entity;

import cn.zjutleo.village_server.util.StringUtils;
import lombok.Data;

import java.math.BigInteger;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author: 张坤
 * @DateTime: 2021/8/31 12:19
 * @Description: 该类用于 TODO
 */
@Data
public class DispatchRepair {
    private BigInteger dr_id;
    private int dr_user_id;
    private int dr_status;
    private Date dr_time;
    private int dr_ra_id;
    /**
     * @Author: 张坤
     * @DateTime: 2021/8/31 12:19
     * @Description: 该构造函数用于 生成18位随机数
     */
    public static long getRandomId(){
        Date date=new Date();
        DateFormat dateFormat = new SimpleDateFormat("yyMMddHHmmss");
        return Long.parseLong(dateFormat.format(date) + StringUtils.getRandomInt(6));
    }
    /**
     * @Author: 张坤
     * @DateTime: 2021/8/31 12:19
     * @Description: 该构造函数用于 设置id值为时间+随机数
     */
    public DispatchRepair() {
        this.dr_id= BigInteger.valueOf(getRandomId());
        this.dr_status=1;
    }
}
